/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package meteocal.entity;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotNull;
import meteocal.weather.Weather;

/**
 *
 * @author andrea
 */
@Entity
@DiscriminatorValue(value = "W")
public class WeatherNotification extends Notification {
    
    @NotNull
    @Enumerated
    private Weather badWeather;    
    
    public Weather getBadWeather() {
        return badWeather;
    }

    public void setBadWeather(Weather badWeather) {
        this.badWeather = badWeather;
    }   
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final WeatherNotification other = (WeatherNotification) obj;
        
        return this.badWeather.equals(other.badWeather);
    }
    
    @Override
    public int hashCode() {
        return super.hashCode();
    }
    
    @Override
    public String toString(){
        return String.format("Forecast for your event %s is %s!",
                event.getTitle(),
                badWeather.toString());
    }
    
}
